﻿using System.Collections.Generic;

//
// Created by Arosy on 2021/11/21.
//

//
// Created by Arosy on 2021/11/21.
//


//#include "InstanceOop.h"

//extern class InstanceOop;

public class InstanceKlass
{
	private uint magic; //魔数，CAFEBABE:用来校验是否是.class文件
	private short minorVersion; //JDK次版本号
	private short majorVersion; //JDK主版本号
	private short constantPoolCount; //常量数量
	private ConstantPool constantPool; //常量池数据
	private short accessFlags; //类的访问权限
	private short thisClass; //类名
	private short superClass; //父类名
	private short interfacesCount; //接口数量
	private InterfacesInfo[] interfaces; //接口
	private short fieldsCount; //字段数量
	private FieldsInfo[] fieldsInfo; //字段
	private short methodCount; //方法数量
	private MethodInfo[] methodInfo; //方法
	private short attributeCount; //属性数量
	private AttributeInfo[] attributeInfo; //属性
	public SortedDictionary<string, CommonValue > staticValue = new SortedDictionary<string, CommonValue >(); //静态变量

/**
   * 创建对象的方法
*/
	public static InstanceOop allocateInstance(InstanceKlass klass)
	{
		InstanceOop oop = new InstanceOop();
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 TODO TASK: C# does not have an equivalent to pointers to variables (in C#, the variable no longer points to the original when the original variable is re-assigned):
//ORIGINAL LINE: oop->klass = klass;
		oop.klass = klass;
		//todo:对象头，申请内存等
		return oop;
	}

/**
   * 以下为getter && setter && 构造方法
*/

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: short getAttributeCount() const
	public short getAttributeCount()
	{
		return attributeCount;
	}

	public void setAttributeCount(short attributeCount)
	{
		this.attributeCount = attributeCount;
	}

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: AttributeInfo *getAttributeInfo() const
	public AttributeInfo[] getAttributeInfo()
	{
		return attributeInfo;
	}

	public void setAttributeInfo(AttributeInfo[] attributeInfo)
	{
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 TODO TASK: C# does not have an equivalent to pointers to variables (in C#, the variable no longer points to the original when the original variable is re-assigned):
//ORIGINAL LINE: InstanceKlass::attributeInfo = attributeInfo;
if(this.attributeInfo==null)
		this.attributeInfo = attributeInfo;
	}

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: short getMethodCount() const
	public short getMethodCount()
	{
		return methodCount;
	}

	public void setMethodCount(short methodCount)
	{
		this.methodCount = methodCount;
	}

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: MethodInfo *getMethodInfo() const
	public MethodInfo[] getMethodInfo()
	{
		return methodInfo;
	}

	public void setMethodInfo(MethodInfo[] methodInfo)
	{
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 TODO TASK: C# does not have an equivalent to pointers to variables (in C#, the variable no longer points to the original when the original variable is re-assigned):
//ORIGINAL LINE: InstanceKlass::methodInfo = methodInfo;
if(this.methodInfo==null)
		this.methodInfo = methodInfo;
	}

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: short getFieldsCount() const
	public short getFieldsCount()
	{
		return fieldsCount;
	}

	public void setFieldsCount(short fieldsCount)
	{
		this.fieldsCount = fieldsCount;
	}

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: FieldsInfo *getFieldsInfo() const
	public FieldsInfo[] getFieldsInfo()
	{
		return fieldsInfo;
	}

	public void setFieldsInfo(FieldsInfo[] fieldsInfo)
	{
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 TODO TASK: C# does not have an equivalent to pointers to variables (in C#, the variable no longer points to the original when the original variable is re-assigned):
//ORIGINAL LINE: InstanceKlass::fieldsInfo = fieldsInfo;
if(this.fieldsInfo==null)
		this.fieldsInfo = fieldsInfo;
	}

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: short getInterfacesCount() const
	public short getInterfacesCount()
	{
		return interfacesCount;
	}

	public void setInterfacesCount(short interfacesCount)
	{
		this.interfacesCount = interfacesCount;
	}

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: InterfacesInfo *getInterfaces() const
	public InterfacesInfo[] getInterfaces()
	{
		return interfaces;
	}

	public void setInterfaces(InterfacesInfo[] interfaces)
	{
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 TODO TASK: C# does not have an equivalent to pointers to variables (in C#, the variable no longer points to the original when the original variable is re-assigned):
//ORIGINAL LINE: InstanceKlass::interfaces = interfaces;
if(this.interfaces==null)
		this.interfaces = interfaces;
	}

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: short getThisClass() const
	public short getThisClass()
	{
		return thisClass;
	}

	public void setThisClass(short thisClass)
	{
		this.thisClass = thisClass;
	}

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: short getSuperClass() const
	public short getSuperClass()
	{
		return superClass;
	}

	public void setSuperClass(short superClass)
	{
		this.superClass = superClass;
	}

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: short getAccessFlags() const
	public short getAccessFlags()
	{
		return accessFlags;
	}

	public void setAccessFlags(short accessFlags)
	{
		this.accessFlags = accessFlags;
	}

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: short getConstantPoolCount() const
	public short getConstantPoolCount()
	{
		return constantPoolCount;
	}

	public void setConstantPoolCount(ushort constantPoolCount)
	{
		this.constantPoolCount = (short)constantPoolCount;
	}

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: ConstantPool *getConstantPool() const
	public ConstantPool getConstantPool()
	{
		return constantPool;
	}

	public void setConstantPool(ConstantPool constantPool)
	{
//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 TODO TASK: C# does not have an equivalent to pointers to variables (in C#, the variable no longer points to the original when the original variable is re-assigned):
//ORIGINAL LINE: InstanceKlass::constantPool = constantPool;
		this.constantPool = constantPool;
	}

//C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
//ORIGINAL LINE: short getMinorVersion() const
	public short getMinorVersion()
	{
		return minorVersion;
	}

	public void setMinorVersion(short minorVersion)
	{
		this.minorVersion = minorVersion;
	}

    public void setMinorVersion(ushort minorVersion)
    {
        this.minorVersion = (short)minorVersion;
    }

    //C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
    //ORIGINAL LINE: short getMajorVersion() const
    public short getMajorVersion()
	{
		return majorVersion;
	}

	public void setMajorVersion(short majorVersion)
	{
		this.majorVersion = majorVersion;
	}

    public void setMajorVersion(ushort majorVersion)
    {
        this.majorVersion = (short)majorVersion;
    }

    //C++ TO C# CONVERTER CRACKED BY X-CRACKER 2017 WARNING: 'const' methods are not available in C#:
    //ORIGINAL LINE: int getMagic() const
    public uint getMagic()
	{
		return magic;
	}

	public void setMagic(uint magic)
	{
		this.magic = magic;
	}

    public void setMagic(int magic)
    {
        this.magic = (uint)magic;
    }
}
